package com.freecloud.javabasics.thread.time;

import java.util.Timer;
import java.util.TimerTask;

/**
 * @Author: maomao
 * @Date: 2021-03-23 17:47
 */
public class OutOfTime {

    static class ThrowTask extends TimerTask{
        @Override
        public void run() {
            throw new RuntimeException();
        }
    }

    public static void main(String[] args) throws Exception {
        Timer timer = new Timer();
        timer.schedule(new ThrowTask(),1);
        Thread.sleep(1000);
        timer.schedule(new ThrowTask(),1);
        Thread.sleep(5000);
    }
}
